package com.example.testdown;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.support.constraint.ConstraintLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private ImageView animator_tv;
    private ConstraintLayout textViews;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        animator_tv=findViewById(R.id.path);
        animatorStyleOne();
    }
    private void animatorStyleOne() {
        ObjectAnimator translateYAnimaotr = ObjectAnimator.ofFloat(animator_tv, "translationY", 0f, 90f);
        ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(animator_tv, "scaleY", 1f, 1.7f,1f);
        ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(animator_tv, "scaleY", 0, 1f );
        ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(animator_tv, "alpha", 1f, 1f,0.5f);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.play(translateYAnimaotr).with(scaleYAnimator).with(alphaAnimator);
        //设置动画时间
        animatorSet.setDuration(2000);
        //开始动画
        animatorSet.start();
    }
}
